package com.ruoyi.market;

import com.ruoyi.common.enums.FileTypeEnum;
import com.ruoyi.common.utils.StringUtils;
import lombok.Getter;

@Getter
public enum OssDirEnum {

    PRODUCT(FileTypeEnum.PRODUCT.getValue(), "pro/logo/{}", "prologo_{}"),
    BILL(FileTypeEnum.BILL.getValue(), "bill/{}", "bill_{}"),
    STORE(FileTypeEnum.STORE.getValue(), "store/{}", "store_{}"),
    PRODLOGO(FileTypeEnum.PRODLOGO.getValue(), "prodlogo/{}", "prodlogo_{}"),
    ;

    private String value;
    private String path;
    private String prefix;

    OssDirEnum(String value, String path, String prefix){
        this.value = value;
        this.path = path;
        this.prefix = prefix;
    }

    public static OssDirEnum getPathByValue(String value){
        for (OssDirEnum item: values()){
            if (StringUtils.equals(value, item.getValue())){
                return item;
            }
        }
        return null;
    }
}
